Fix specs after the transition from skip_agent to {{agent}}.

Akinori MUSHA 10 years ago
parent
commit
9ab66aa32e
1 changed files with 5 additions and 17 deletions
  1. 5 17
      spec/models/agents/event_formatting_agent_spec.rb

+ 5 - 17
spec/models/agents/event_formatting_agent_spec.rb

@@ -7,7 +7,8 @@ describe Agents::EventFormattingAgent do
7 7
         :options => {
8 8
             :instructions => {
9 9
                 :message => "Received {{content.text}} from {{content.name}} .",
10
-                :subject => "Weather looks like {{conditions}} according to the forecast at {{pretty_date.time}}"
10
+                :subject => "Weather looks like {{conditions}} according to the forecast at {{pretty_date.time}}",
11
+                :agent => "{{agent.type}}",
11 12
             },
12 13
             :mode => "clean",
13 14
             :matchers => [
@@ -17,7 +18,6 @@ describe Agents::EventFormattingAgent do
17 18
                     :to => "pretty_date",
18 19
                 },
19 20
             ],
20
-            :skip_agent => "false",
21 21
             :skip_created_at => "false"
22 22
         }
23 23
     }
@@ -53,14 +53,6 @@ describe Agents::EventFormattingAgent do
53 53
       Event.last.payload[:content].should_not == nil
54 54
     end
55 55
 
56
-    it "should accept skip_agent" do
57
-      @checker.receive([@event])
58
-      Event.last.payload[:agent].should == "WeatherAgent"
59
-      @checker.options[:skip_agent] = "true"
60
-      @checker.receive([@event])
61
-      Event.last.payload[:agent].should == nil
62
-    end
63
-
64 56
     it "should accept skip_created_at" do
65 57
       @checker.receive([@event])
66 58
       Event.last.payload[:created_at].should_not == nil
@@ -69,12 +61,13 @@ describe Agents::EventFormattingAgent do
69 61
       Event.last.payload[:created_at].should == nil
70 62
     end
71 63
 
72
-    it "should handle JSONPaths in instructions" do
64
+    it "should handle Liquid templating in instructions" do
73 65
       @checker.receive([@event])
74 66
       Event.last.payload[:message].should == "Received Some Lorem Ipsum from somevalue ."
67
+      Event.last.payload[:agent].should == "WeatherAgent"
75 68
     end
76 69
 
77
-    it "should handle matchers and JSONPaths in instructions" do
70
+    it "should handle matchers and Liquid templating in instructions" do
78 71
       @checker.receive([@event])
79 72
       Event.last.payload[:subject].should == "Weather looks like someothervalue according to the forecast at 10:00 PM EST"
80 73
     end
@@ -152,11 +145,6 @@ describe Agents::EventFormattingAgent do
152 145
       @checker.should_not be_valid
153 146
     end
154 147
 
155
-    it "should validate presence of skip_agent" do
156
-      @checker.options[:skip_agent] = ""
157
-      @checker.should_not be_valid
158
-    end
159
-
160 148
     it "should validate presence of skip_created_at" do
161 149
       @checker.options[:skip_created_at] = ""
162 150
       @checker.should_not be_valid